﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shiputzypj_Manage.aspx.cs"
    Inherits="Catering.Catering_Page.Caipin.shiputzypj_Manage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>食谱调整与评价</title>
    <link rel="stylesheet" type="text/css" href="../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/center.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/ekangframe.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/ekangcomplex.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/jquery.alerts.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../../Style/jquery.treeview.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/contextmenu.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/jqueryload.css" />
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../Style/zhezhao.css" />
    <script type="text/javascript" src="../../Style/zhezhao.js"></script>
    <script src="../../Style/xxk.js" type="text/javascript"></script>
    <script type="text/javascript">
        var IsTZ = false;
        $(document).ready(function () {
            $(document).bind("selectstart", function () { return false; });
            var uid = "1";

            $("#li_btn_zd", $("#frame_1_3").contents()).hide();
            $("#Load_Repice", $("#frame_1_3").contents()).hide();

            DishBing();

            $(document).mousemove(function (event) {
                if ($("#cai_info", $("#frame_1_3").contents()).css("display") == "block") {
                    $("#cai_info", $("#frame_1_3").contents()).css("display", "none");
                    $('#cai_info').css("display", "block");
                }
                $("#cai_info").css({ left: event.pageX + 5 + 'px', top: event.pageY + 5 + 'px' });
            });

            $(document).mouseup(function () {
                $("#cai_info").css("display", "none");
                IsTZ = false;
            });

            //查询菜品
            $("#Search_btn").click(function () {
                $("#DishList a").css("color", "#000");
                var serach_txt = $("#Search_txt").val();
                $("#DishList a:contains('" + serach_txt + "')").css("color", "red").parentsUntil("#Dish_List").prev().css("color", "red");
                $("#Search_txt").val("");
            });
        });

        //绑定菜拖拽事件
        function DishBing() {
            $("#Dish_List a[IsCai='false']").click(function () {
                $(this).next().toggleClass("display_none");
            });
            $("#Dish_List a[IsCai='false']").trigger("click");

            $("#Dish_List a[IsCai='true']").mousedown(function (event) {
                uid = $(this).attr("uid");
                $.ajax({
                    type: "Post",
                    url: "shipu_left.aspx/CaiPin_Info_Tedian",
                    data: "{'Dish_ID':'" + uid + " '}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var strHtml = "<tr><td name=\"id\" style=\"display:none;\"  colspan=\"2\">" + uid + "</td></tr>" +
                                      "<tr><td colspan=\"2\">" + data.d[0] + "</td></tr>" +
                                      "<tr><td style=\"width:80px\">热量(千卡):</td><td>" + data.d[1] + "</td></tr>" +
                                      "<tr><td>蛋白质(克):</td><td>" + data.d[2] + "</td></tr>" +
                                      "<tr><td>脂肪(克):</td><td>" + data.d[3] + "</td></tr>" +
                                      "<tr><td>特点:</td><td>" + data.d[4] + "</td></tr>";
                        var strTablehtml = "<table width=\"100%\"><tbody>" + strHtml + "</tbody></table>";
                        $("#cai_info", $("#frame_1_3").contents()).html(strTablehtml);
                        $("#cai_info").html(strTablehtml);
                        $("#cai_info").css("display", "block");
                        $("#cai_info").css({ left: event.pageX + 5 + 'px', top: event.pageY + 5 + 'px' });
                        IsTZ = true;
                    }
                }); 
            });
        }

        //隐藏自动生成控件
        function hide_zidong() {
            $("#li_btn_zd", $("#frame_1_3").contents()).hide();
            $("#Load_Repice", $("#frame_1_3").contents()).hide();
            //$("#li_btn_Exp", $("#frame_1_3").contents()).hide();
        }

        //加载食谱库
        function LoadDish() {
            var RecipesID = $("#Hidshipuid", $("#frame_1_3").contents()).val();

            if (RecipesID == "")
                return;

            $.ajax({
                type: "Post",
                url: "shiputzypj_Manage.aspx/Getlibrary",
                data: "{'RecipesID':'" + RecipesID + " '}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d[0] == "OK") {
                        $("#library_list").html(data.d[1]);
                        libraryBing();
                        LoadDishInfo(data.d[2]);
                        $("#library_Name").text(data.d[3]);
                    }
                }
            });
        }

        //绑定食谱库选择事件
        function libraryBing() {
            $("#library_list tr").mouseover(function () {
                $("#library_list tr").css("background-color", "#fff");
                $(this).css("background-color", "#999");
            });

            $("#library_list tr").click(function () {
                LoadDishInfo($(this).attr("uid"));
                $("#library_Name").text($(this).attr("uname"));
                divhidel("divmain", "divup");
            });
        }

        //加载食谱库对应的菜
        function LoadDishInfo(libraryID) {
            $.ajax({
                type: "Post",
                url: "shiputzypj_Manage.aspx/GetDishInfoByLish",
                data: "{'Lid':'" + libraryID + " '}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#Dish_List").html(data.d[0]);
                    $("#dishNum").html("("+data.d[1]+")");
                    DishBing();
                }
            });
        }

        //显示当前食谱
        function ShowDangQian() {
            divshow("div_shipu", "divmain");
            
        }
    </script>
    <style type="text/css">
        .display_none
        {
            display: none;
        }
        .display_block
        {
            display: block;
        }
        .list_css ul
        {
            width: auto;
        }
        #cai_info
        {
            position: absolute;
            border: 1px solid #2a77af;
            width: 200px;
            min-height: 180px;
            max-height: 300px;
            z-index: 1001;
            background-color: #f9a000;
            display: none;
            padding: 5px;
            filter: Alpha(Opacity=90);
        }
        #cai_info li
        {
            width: 100%;
            margin-bottom: 5px;
            color: #fff;
        }
        #Dish_List a
        {
            cursor: pointer;
        }
        #Dish_List a:hover
        {
            background-color: #f3e724;
        }
        #library_list tr
        {
            cursor: pointer;
        }
    </style>
</head>
<body>
    <form runat="server" id="from1">
    <div id="cai_info">
    </div>
    <div class="Center_Content">
        <div class="Create_Recipe">
            <div class="left_CR">
                <div class="Recipe_0206" style="margin-bottom:8px;">
                    <h1><a href="#rhis" onclick='divshow("divmain","divup")'>选择菜谱</a></h1>
                    <div class="Dl_div">
                        <h2 id="library_Name">
                            菜谱</h2>
                        <div id="DishList">
                            <div style="width: 175px; height:400px; overflow: auto;">
                                <ul style="float: left; height: 100%;" class="filetree treeview">
                                    <li class="open list_css"><a iscai="false">菜肴<label id="dishNum"></label></a>
                                        <ul id="Dish_List">
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="soso_lt">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td height="28" align="center" width="150">
                                        <asp:TextBox ID="Search_txt" runat="server" Text="" class="input_bg" onfocus="this.select();" style="width:140px; clear:both;" /></td>
                                    <td><input id="Search_btn" type="button" class="button_soso_lt" style=" margin:0px;" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="Right_CR">
                <div style="z-index: 2; width: 790px; display: block; height: 491px; visibility: visible;
                    overflow: hidden; right: 0px; left: 303px" id="mainContent" class="middle-center pane pane-center open">
                    <div style="border-bottom: medium none; height: 571px; border-left: medium none;
                        overflow: hidden; border-top: medium none; border-right: medium none" id="divmainframecontent"
                        class="ui-layout-content">
                        <iframe id="frame_1_3" class="ui-layout-center" src="shippu_regth.aspx" frameborder="0"
                            name="frame_1_3" scrolling="no"></iframe>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer" style="height: 40px; background-color: #fff;">
        <strong>中海油能源发展配餐服务公司渤海自营油田作业公司&nbsp;&nbsp;版权所有@CopyRight 2012</strong><span>技术支持：北京天择嘉业科技有限公司</span>
    </div>
    <!--遮罩层-->
    <div id="divmain" class="bg">
    </div>
    <!--弹出层-->
    <div id="divup" class="center_div" style="padding: 0px 0px 6px 0px; margin-top: -130px;
        width: 460px">
        <table cellpadding="0" cellspacing="0" border="0" width="460px">
            <tr>
                <td>
                    <div class="div_0207 left_width400" style="width:458px; margin:0px;" >
                        <h1><img src="../../Images/cp_h1_03.gif" />菜谱库</h1>
                        <div style="max-height:203px; overflow-y:scroll;">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                            <thead>
                                <tr>
                                    <td style="width: 50px">
                                        序号
                                    </td>
                                    <td style="width: 150px">
                                        菜谱库名称
                                    </td>
                                    <td style="width: 250px">
                                        备注
                                    </td>
                                </tr>
                            </thead>
                            <tbody id="library_list">
                            </tbody>
                        </table>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <table width="100%">
            <tr align="center">
                <td align="right">
                    <input type="button" value="确定" class="input_btn_a" onclick="" />
                </td>
                <td align="left">
                    <input type="button" value="关闭" class="input_btn_a" onclick='divhidel("divmain","divup")' />
                </td>
            </tr>
        </table>
    </div>
    <!--当前食谱-->
    <div id="div_shipu" class="center_div" style="padding: 0px 0px 10px 0px; margin-top: -130px;width:900px; left:40%">
        <div class="Tab_table_0206">
            <table style="width: 900px; background-color: #dbf4df;" class="pgridtable" border="1"
                cellspacing="0" cellpadding="0">
                <thead>
                    <tr>
                        <th style="cursor: pointer" class="pgridtd" rowspan="2">
                            餐别
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期一(Monday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期二(Tuesday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期三(Wednesday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期四(Thursday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期五(Friday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期六(Saturday)
                        </th>
                        <th style="height: 30px; cursor: default" class="pgridtd">
                            星期日(Sunday)
                        </th>
                    </tr>
                </thead>
                <tbody id="div_shipu_main">
                    
                </tbody>
            </table>
        </div>
        <table width="100%">
            <tr>
                <td align="center">
                    <input type="button" value="关闭" class="input_btn_a" onclick='divhidel("div_shipu", "divmain")' />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
